<%@page language="java" import="com.scalar.chiptrack.operations.LotView, 
                                java.util.ArrayList, 
                                java.util.Iterator,
								com.scalar.chiptrack.commons.Constants,
                                com.scalar.chiptrack.utils.ConfigManager"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/pcmData.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();
  String pcmdataLink = ConfigManager.getTSMCPathLink(); %>
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>
<SCRIPT language="JavaScript1.2">
     function submitPage(tempAction)
    {
        var pa=document.getElementById("message");
        var x = document.prrocessFlowForm.partNumber;
        for(var i = 0; i< x.length; i++){
           if(x.options[i].selected){
                if((x.options[i].value == "Select Product") ||(x.options[i].value == null)){
	        		pa.innerText = "Select Product";
			        return;
       		    }
            	 document.prrocessFlowForm.productName.value = x.options[i].innerText;
        		 document.prrocessFlowForm.processStepId.value = x.options[i].value;
            }
        }

        document.prrocessFlowForm.flowaction.value = tempAction;
        document.prrocessFlowForm.submit();
     }
</SCRIPT>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0'>
<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
    <!-- Side Navigation start -->
    <%@include file="/jsp/operations/operations_menu.jsp" %>
    </TD>
    <!-- end of the side navigations -->
    <TD bgcolor="#ffffff">
    <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="images/spacer.gif" width=2></TD>
    <TD valign="top" width="100%">

    <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
    <BR>
    <!-- from here your body starts -->
    <html:form name="prrocessFlowForm"  type="com.scalar.chiptrack.operations.process.forms.WipProcessFlowForm" action="/pcmData.do">
    <center><span class="NArialW">PCM Data</span></center>
    <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>
	<center>
	<strong><font face="Verdana" size="-5" align="center" color="#ff0000" id="message"></font>
	</center>
    <%
	    String message = (String)request.getAttribute("errorMessage");
   	    if(message==null)
   		message="";
    %>
    <%
 	    if(!message.equals("")){
    %>
      <SCRIPT language="JavaScript1.2">
    	var pa=document.getElementById("message");
    	pa.innerHTML = "<%= message%>";
      </SCRIPT>
    <%
 	  }
    %>
    <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>
    <%
        String from = (String)request.getAttribute("from");
	    String showList = (String)request.getAttribute("showList");
    %>
    <table border="0" width="90%" align='center'>
    <tr>
         <td>
	        <table border="0" width="100%" align="center">
 	        <tr>
       		    <td width="50%" align="right"><font class="NArialL" >Product Name &nbsp;:&nbsp;</font></td>
       		    <td width="50%" algin="left" ><font class="NArialL" >
                <html:select name="processFlow" property="partNumber" styleClass="txfield" name="prrocessFlowForm">
     	    		<html:option value="Select Product" />
            		<html:options collection="fabPartNumbers" property="value" labelProperty="label"/>
        	    </html:select>
        		</td>
    	     </tr>
     	     <tr>
	     	    <td colspan=2><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td>
	        </tr>
 	        <tr>
       		    <td colspan=2 align=center>
                <a href="javascript:submitPage('<%= from%>')">
		        <img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Search for PCM Data';return true" onmouseout="window.status='';return true" title="Click here to Search for PCM Data"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<%--<a href="<%=chipTracContext%>/pcmData.do">
       		    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17">
				</a> --%>
                <!--Commented and added Reset Button by varma 23 jul 2004 -->
                <a href="javascript:document.prrocessFlowForm.reset();">
                <img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
		        </td>
     	    </tr>
  	        </table>
        </td>
    </tr>
    <tr>
         <td><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
    </tr>
    <tr>
        <td><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td>
    </tr>
    <tr>
     <td>
        <%
	    	if("VIEW_LOTS".equalsIgnoreCase(showList)){
		         ArrayList list = (ArrayList)request.getAttribute("fabLotNumbers");
		         String productName = (String)request.getAttribute("productName");
	        %>
                <table border="3" width="100%" bordercolor="#FFFFFF" align='center'>
          	   <tr>
				<% if ( list != null && list.size() > 0 ) {%>
	               <td class="NArialS" colspan="5"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>
				   <IMG src="<%=chipTracContext%>/jsp/includes/images/exclamation-46x47.gif" height=15 width=15>
					<font color='blue'><b><%=Constants.PCM_DATA_LOT_DETAILS_MESSAGE%></b></font>
				   </td>
			   <% } else {%>
	               <td class="NArialL" colspan="5"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td>
			   <% } %>
	            </tr>
   	            <tr>
		            <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Lot No</font></td>
                    <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Product Name</font></td>
                    <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">WAT</font></td>
                    <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">WSM</font></font></td>
                    <td align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">QCI</font></font></td>
                </tr>
	        <%
		    Iterator it = list.iterator();
		    int i =0;
            String bgColor = "#FFFFEE";
		    while(it.hasNext()){

			    ArrayList tempList = (ArrayList)it.next();
                String lotNumber = (String)tempList.get(0);
			    String wat = (String)tempList.get(1);
			    String wsm = (String)tempList.get(2);
			    String qci = (String)tempList.get(3);

       			if((i%2) == 0){
                    bgColor ="#DEE1E2";
                }else{
                    bgColor = "#FFFFEE";
                }
                %>

                <tr>
                  <td align="left" bgcolor="<%=bgColor%>"><font class="NArialL">&nbsp;<%= lotNumber %></font></td>
                  <td align="left" bgcolor="<%=bgColor%>"><font class="NArialL">&nbsp;<%= productName %></font></td>
                  <td align="center" bgcolor="<%=bgColor%>"><font class="NArialL">&nbsp;<% if((wat != null) && (!wat.equalsIgnoreCase(""))){ %><a href="<%= chipTracContext + pcmdataLink + wat %>" target="_blank" 
				  title="Please right-click & choose Save target as">WAT</a> <% } %></font></td>
                  <td align="center" bgcolor="<%=bgColor%>"><font class="NArialL">&nbsp;<% if((wsm != null) && (!wsm.equalsIgnoreCase(""))){ %><a href="<%= chipTracContext + pcmdataLink + wsm %>" target="_blank" 
				  title="Please right-click & choose Save target as">WSM</a> <% } %></font></td>
                  <td align="center" bgcolor="<%=bgColor%>"><font class="NArialL">&nbsp;<% if((qci != null) && (!qci.equalsIgnoreCase(""))){ %><a href="<%= chipTracContext + pcmdataLink + qci %>" target="_blank" 
				  title="Please right-click & choose Save target as to save the details (set file type to All Files)">QCI</a> <% } %></font></td>
                </tr>

               <%
    			i++;
 		   }
           if( i == 0 ){
            %>
                <tr>
                  <td align="center" bgcolor="<%=bgColor%>" colspan="5"><font class="NArialL">
                  There is no PCM Data present for the lots corresponding to the <%= productName %> </font></td>
                </tr>
            <%
           }
	      %>
    	</table>
	  <% }  %>
    <input type="hidden" name="flowaction" value="">
    <input type="hidden" name="productName" value="">
    <input type="hidden" name="processStepId" value="" >
    </html:form>
    </td>
    </tr>
    </table>

    <!-- till here -->
    </TD>
    <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
    </TABLE>

    <!-- Footer starts here -->
    <%@include file="/jsp/includes/footer.jsp" %>
    <!-- footer end here -->
</BODY>
</HTML>